//
// Copyright (C) 2011 - 2013  Steve Channell steve.channell@cepheis.com
//
// This file is part of Cephei.QL, an open-source library wrapper 
// arround QuantLib http://quantlib.org/
//
// Cephei.QL is open source software: you can redistribute it and/or modify it
// under the terms of the license.  You should have received a
// copy of the license along with this program; if not, please email
// <support@cepheis.com>. The license is also available online at
// <http://cepheis.com/license.htm>.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE.  See the license for more details.
//
// Version 2.2 with QuantLib 1.2.1
//#include "stdafx.h"
#include "MakeOIS.h"
using namespace Cephei::QL::Instruments;
#include <gen/QL/Times/Period.h>
#include <gen/QL/Indexes/OvernightIndex.h>
#include <gen/QL/Instruments/OvernightIndexedSwap.h>
#include <gen/QL/Termstructures/YieldTermStructure.h>
#include <gen/QL/Times/DayCounter.h>
using namespace Cephei::QL::Times;
using namespace Cephei::QL::Indexes;
using namespace Cephei::QL::Termstructures;
#undef HANDLE
#undef ABSTRACT
#undef STRUCT
Cephei::QL::Instruments::CMakeOIS::CMakeOIS (Cephei::QL::Times::IPeriod^ swapTenor, Cephei::QL::Indexes::IOvernightIndex^ overnightIndex, Microsoft::FSharp::Core::FSharpOption<Double>^ fixedRate, Microsoft::FSharp::Core::FSharpOption<Cephei::QL::Times::IPeriod^>^ fwdStart) 
{
	_pSpinlock = new boost::detail::spinlock ();
    CPeriod^ _CswapTenor;
    COvernightIndex^ _CovernightIndex;
    CPeriod^ _CfwdStart;
    try
    {
#ifdef HANDLE
        _phMakeOIS = NULL;
#endif
        _CswapTenor = safe_cast<CPeriod^> (swapTenor);
        _CswapTenor->Lock();
        QuantLib::Period& _swapTenor = static_cast<QuantLib::Period&> (_CswapTenor->GetReference ()); 
        _CovernightIndex = safe_cast<COvernightIndex^> (overnightIndex);
        _CovernightIndex->Lock();
        boost::shared_ptr<QuantLib::OvernightIndex>& _overnightIndex = static_cast<boost::shared_ptr<QuantLib::OvernightIndex>&> (_CovernightIndex->GetShared ()); 
        QuantLib::Rate _fixedRate = 
            (Microsoft::FSharp::Core::FSharpOption<Double>::IsSome::get (fixedRate) ? (QuantLib::Rate)ValueHelper::Convert (fixedRate->Value) : Null<QuantLib::Rate>()); //4
        if (Microsoft::FSharp::Core::FSharpOption<Cephei::QL::Times::IPeriod^>::IsSome::get (fwdStart))
        {
            _CfwdStart = safe_cast<CPeriod^> (fwdStart->Value);
            _CfwdStart->Lock();
        }
        QuantLib::Period& _fwdStart = 
            (Microsoft::FSharp::Core::FSharpOption<Cephei::QL::Times::IPeriod^>::IsSome::get (fwdStart) ? static_cast<QuantLib::Period&> (_CfwdStart->GetReference ()) : 0*Days); //1
        _ppMakeOIS = new boost::shared_ptr<QuantLib::MakeOIS> (new QuantLib::MakeOIS ( _swapTenor,  _overnightIndex,  _fixedRate,  _fwdStart ));
        
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown std::exception"));
	}
    finally
    {
        if (_CswapTenor != nullptr) _CswapTenor->Unlock();
        if (_CovernightIndex != nullptr) _CovernightIndex->Unlock();
        if (_CfwdStart != nullptr) _CfwdStart->Unlock();
    }
}
Cephei::QL::Instruments::CMakeOIS::CMakeOIS (boost::shared_ptr<QuantLib::MakeOIS>& childNative, Object^ owner) 
{
	_pSpinlock = new boost::detail::spinlock ();
#ifdef HANDLE
	_phMakeOIS = NULL;
#endif
	_ppMakeOIS = &childNative;
    
}
Cephei::QL::Instruments::CMakeOIS::CMakeOIS (QuantLib::MakeOIS& childNative, Object^ owner) 
{
#ifdef HANDLE
	_phMakeOIS = NULL;
#endif
	_ppMakeOIS = new boost::shared_ptr<QuantLib::MakeOIS> (&childNative);
    
    _MakeOISOwner = owner;
    
}

Cephei::QL::Instruments::CMakeOIS::CMakeOIS (CMakeOIS^ copy) 
{
	_pSpinlock = new boost::detail::spinlock ();
#ifdef HANDLE
	_phMakeOIS = NULL;
#endif
	if (copy->HasNative() != NULL)
    {
		_ppMakeOIS = new boost::shared_ptr<QuantLib::MakeOIS> (copy->GetShared());
        
    }
}
Cephei::QL::Instruments::CMakeOIS::CMakeOIS (PLATFORM::Type^ t) 
{
	_pSpinlock = new boost::detail::spinlock ();
#ifdef HANDLE
	_phMakeOIS = NULL;
#endif
	if (!t->IsSubclassOf(CMakeOIS::typeid))
		throw REFNEW Exception ("Invalid base-case init");
}
#ifdef HANDLE
Cephei::QL::Instruments::CMakeOIS::CMakeOIS (QuantLib::Handle<QuantLib::MakeOIS>& childNative, Object^ owner)  
{
	_pSpinlock = new boost::detail::spinlock ();
	_phMakeOIS = &childNative;
	_ppMakeOIS = &static_cast<boost::shared_ptr<QuantLib::MakeOIS>>(childNative.currentLink());
    
    _MakeOISOwner = owner;
}
Cephei::QL::Instruments::CMakeOIS::CMakeOIS (QuantLib::Handle<QuantLib::MakeOIS> childNative)  
{
	_pSpinlock = new boost::detail::spinlock ();
	_phMakeOIS = &childNative;
	_ppMakeOIS = &static_cast<boost::shared_ptr<QuantLib::MakeOIS>>(childNative.currentLink());
    
}
#endif
#ifdef STRUCT
Cephei::QL::Instruments::CMakeOIS::CMakeOIS (QuantLib::MakeOIS childNative)  
{
	_pSpinlock = new boost::detail::spinlock ();
#ifdef HANDLE
	_phMakeOIS = NULL;
#endif
	_ppMakeOIS = new boost::shared_ptr<QuantLib::MakeOIS> (new QuantLib::MakeOIS (childNative));
    
}
#endif

Cephei::QL::Instruments::CMakeOIS::~CMakeOIS ()
{
	if (_pSpinlock != NULL)
    {
        delete _pSpinlock;
        _pSpinlock = NULL;
    }
    if (_ppMakeOIS != NULL)
    {
	    delete _ppMakeOIS;
        _ppMakeOIS = NULL;
    }
}
Cephei::QL::Instruments::CMakeOIS::!CMakeOIS ()
{
	if (_pSpinlock != NULL)
    {
        delete _pSpinlock;
    }
    if (_ppMakeOIS != NULL)
    {
	    delete _ppMakeOIS;
    }
}
QuantLib::MakeOIS& Cephei::QL::Instruments::CMakeOIS::GetReference ()
{
    if (_ppMakeOIS == NULL) throw REFNEW NativeNullException ();
	return **_ppMakeOIS;
}
boost::shared_ptr<QuantLib::MakeOIS>& Cephei::QL::Instruments::CMakeOIS::GetShared ()
{
    if (_ppMakeOIS == NULL) throw REFNEW NativeNullException ();
	return *_ppMakeOIS;
}
QuantLib::MakeOIS* Cephei::QL::Instruments::CMakeOIS::GetPointer ()
{
    if (_ppMakeOIS == NULL) throw REFNEW NativeNullException ();
	return &**_ppMakeOIS;
}
#ifdef HANDLE
QuantLib::Handle<QuantLib::MakeOIS>& Cephei::QL::Instruments::CMakeOIS::GetHandle ()
{
	if (_phMakeOIS == NULL)
	{
		_phMakeOIS = new Handle<QuantLib::MakeOIS> (*_ppMakeOIS);
	}
	return *_phMakeOIS;
}
#endif
bool Cephei::QL::Instruments::CMakeOIS::HasNative () 
{
	return (_ppMakeOIS != NULL);
}

Cephei::QL::Instruments::IMakeOIS^ Cephei::QL::Instruments::CMakeOIS::ReceiveFixed (Microsoft::FSharp::Core::FSharpOption<Boolean>^ flag)
{
    try
    {
    	boost::detail::spinlock::scoped_lock lock (*_pSpinlock);
        bool _flag = 
            (Microsoft::FSharp::Core::FSharpOption<Boolean>::IsSome::get (flag) ? (bool)ValueHelper::Convert (flag->Value) : true); //9a
    	QuantLib::MakeOIS& _rv = (QuantLib::MakeOIS&)(*_ppMakeOIS)->receiveFixed ( _flag );   
        Cephei::QL::Instruments::CMakeOIS^ _nrv = REFNEW Cephei::QL::Instruments::CMakeOIS (_rv, this);
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown std::exception"));
	}
    finally
    {
    }
}
Cephei::QL::Instruments::IMakeOIS^ Cephei::QL::Instruments::CMakeOIS::WithDiscountingTermStructure (Cephei::QL::Termstructures::IYieldTermStructure^ discountingTermStructure)
{
    CYieldTermStructure^ _CdiscountingTermStructure;
    try
    {
    	boost::detail::spinlock::scoped_lock lock (*_pSpinlock);
        _CdiscountingTermStructure = safe_cast<CYieldTermStructure^> (discountingTermStructure);
        _CdiscountingTermStructure->Lock();
        Handle<QuantLib::YieldTermStructure>& _discountingTermStructure = static_cast<Handle<QuantLib::YieldTermStructure>&> (_CdiscountingTermStructure->GetHandle ()); 
    	QuantLib::MakeOIS& _rv = (QuantLib::MakeOIS&)(*_ppMakeOIS)->withDiscountingTermStructure ( _discountingTermStructure );   
        Cephei::QL::Instruments::CMakeOIS^ _nrv = REFNEW Cephei::QL::Instruments::CMakeOIS (_rv, this);
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown std::exception"));
	}
    finally
    {
        if (_CdiscountingTermStructure != nullptr) _CdiscountingTermStructure->Unlock();
    }
}
Cephei::QL::Instruments::IMakeOIS^ Cephei::QL::Instruments::CMakeOIS::WithEffectiveDate (DateTime effectiveDate)
{
    try
    {
    	boost::detail::spinlock::scoped_lock lock (*_pSpinlock);
        QuantLib::Date _effectiveDate = (QuantLib::Date)ValueHelper::Convert (effectiveDate); //a
    	QuantLib::MakeOIS& _rv = (QuantLib::MakeOIS&)(*_ppMakeOIS)->withEffectiveDate ( _effectiveDate );   
        Cephei::QL::Instruments::CMakeOIS^ _nrv = REFNEW Cephei::QL::Instruments::CMakeOIS (_rv, this);
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown std::exception"));
	}
    finally
    {
    }
}
Cephei::QL::Instruments::IMakeOIS^ Cephei::QL::Instruments::CMakeOIS::WithEndOfMonth (Microsoft::FSharp::Core::FSharpOption<Boolean>^ flag)
{
    try
    {
    	boost::detail::spinlock::scoped_lock lock (*_pSpinlock);
        bool _flag = 
            (Microsoft::FSharp::Core::FSharpOption<Boolean>::IsSome::get (flag) ? (bool)ValueHelper::Convert (flag->Value) : true); //9a
    	QuantLib::MakeOIS& _rv = (QuantLib::MakeOIS&)(*_ppMakeOIS)->withEndOfMonth ( _flag );   
        Cephei::QL::Instruments::CMakeOIS^ _nrv = REFNEW Cephei::QL::Instruments::CMakeOIS (_rv, this);
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown std::exception"));
	}
    finally
    {
    }
}
Cephei::QL::Instruments::IMakeOIS^ Cephei::QL::Instruments::CMakeOIS::WithFixedLegDayCount (Cephei::QL::Times::IDayCounter^ dc)
{
    CDayCounter^ _Cdc;
    try
    {
    	boost::detail::spinlock::scoped_lock lock (*_pSpinlock);
        _Cdc = safe_cast<CDayCounter^> (dc);
        _Cdc->Lock();
        QuantLib::DayCounter& _dc = static_cast<QuantLib::DayCounter&> (_Cdc->GetReference ()); 
    	QuantLib::MakeOIS& _rv = (QuantLib::MakeOIS&)(*_ppMakeOIS)->withFixedLegDayCount ( _dc );   
        Cephei::QL::Instruments::CMakeOIS^ _nrv = REFNEW Cephei::QL::Instruments::CMakeOIS (_rv, this);
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown std::exception"));
	}
    finally
    {
        if (_Cdc != nullptr) _Cdc->Unlock();
    }
}
Cephei::QL::Instruments::IMakeOIS^ Cephei::QL::Instruments::CMakeOIS::WithNominal (Double n)
{
    try
    {
    	boost::detail::spinlock::scoped_lock lock (*_pSpinlock);
        QuantLib::Real _n = (QuantLib::Real)ValueHelper::Convert (n); //a
    	QuantLib::MakeOIS& _rv = (QuantLib::MakeOIS&)(*_ppMakeOIS)->withNominal ( _n );   
        Cephei::QL::Instruments::CMakeOIS^ _nrv = REFNEW Cephei::QL::Instruments::CMakeOIS (_rv, this);
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown std::exception"));
	}
    finally
    {
    }
}
Cephei::QL::Instruments::IMakeOIS^ Cephei::QL::Instruments::CMakeOIS::WithOvernightLegSpread (Double sp)
{
    try
    {
    	boost::detail::spinlock::scoped_lock lock (*_pSpinlock);
        QuantLib::Spread _sp = (QuantLib::Spread)ValueHelper::Convert (sp); //a
    	QuantLib::MakeOIS& _rv = (QuantLib::MakeOIS&)(*_ppMakeOIS)->withOvernightLegSpread ( _sp );   
        Cephei::QL::Instruments::CMakeOIS^ _nrv = REFNEW Cephei::QL::Instruments::CMakeOIS (_rv, this);
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown std::exception"));
	}
    finally
    {
    }
}
Cephei::QL::Instruments::IMakeOIS^ Cephei::QL::Instruments::CMakeOIS::WithPaymentFrequency (QL::Times::FrequencyEnum f)
{
    try
    {
    	boost::detail::spinlock::scoped_lock lock (*_pSpinlock);
        QuantLib::Frequency _f = (QuantLib::Frequency)f ;
    	QuantLib::MakeOIS& _rv = (QuantLib::MakeOIS&)(*_ppMakeOIS)->withPaymentFrequency ( _f );   
        Cephei::QL::Instruments::CMakeOIS^ _nrv = REFNEW Cephei::QL::Instruments::CMakeOIS (_rv, this);
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown std::exception"));
	}
    finally
    {
    }
}
Cephei::QL::Instruments::IMakeOIS^ Cephei::QL::Instruments::CMakeOIS::WithRule (QL::Times::DateGeneration::RuleEnum r)
{
    try
    {
    	boost::detail::spinlock::scoped_lock lock (*_pSpinlock);
        QuantLib::DateGeneration::Rule _r = (QuantLib::DateGeneration::Rule)r ;
    	QuantLib::MakeOIS& _rv = (QuantLib::MakeOIS&)(*_ppMakeOIS)->withRule ( _r );   
        Cephei::QL::Instruments::CMakeOIS^ _nrv = REFNEW Cephei::QL::Instruments::CMakeOIS (_rv, this);
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown std::exception"));
	}
    finally
    {
    }
}
Cephei::QL::Instruments::IMakeOIS^ Cephei::QL::Instruments::CMakeOIS::WithSettlementDays (UInt32 fixingDays)
{
    try
    {
    	boost::detail::spinlock::scoped_lock lock (*_pSpinlock);
        QuantLib::Natural _fixingDays = (QuantLib::Natural)ValueHelper::Convert (fixingDays); //a
    	QuantLib::MakeOIS& _rv = (QuantLib::MakeOIS&)(*_ppMakeOIS)->withSettlementDays ( _fixingDays );   
        Cephei::QL::Instruments::CMakeOIS^ _nrv = REFNEW Cephei::QL::Instruments::CMakeOIS (_rv, this);
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown std::exception"));
	}
    finally
    {
    }
}
Cephei::QL::Instruments::IMakeOIS^ Cephei::QL::Instruments::CMakeOIS::WithTerminationDate (DateTime terminationDate)
{
    try
    {
    	boost::detail::spinlock::scoped_lock lock (*_pSpinlock);
        QuantLib::Date _terminationDate = (QuantLib::Date)ValueHelper::Convert (terminationDate); //a
    	QuantLib::MakeOIS& _rv = (QuantLib::MakeOIS&)(*_ppMakeOIS)->withTerminationDate ( _terminationDate );   
        Cephei::QL::Instruments::CMakeOIS^ _nrv = REFNEW Cephei::QL::Instruments::CMakeOIS (_rv, this);
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown std::exception"));
	}
    finally
    {
    }
}
Cephei::QL::Instruments::IMakeOIS^ Cephei::QL::Instruments::CMakeOIS::WithType (QL::Instruments::OvernightIndexedSwap::TypeEnum type)
{
    try
    {
    	boost::detail::spinlock::scoped_lock lock (*_pSpinlock);
        QuantLib::OvernightIndexedSwap::Type _type = (QuantLib::OvernightIndexedSwap::Type)type ;
    	QuantLib::MakeOIS& _rv = (QuantLib::MakeOIS&)(*_ppMakeOIS)->withType ( _type );   
        Cephei::QL::Instruments::CMakeOIS^ _nrv = REFNEW Cephei::QL::Instruments::CMakeOIS (_rv, this);
    	return _nrv;
	}
    catch (QuantLib::Error& _error)
    {
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown quantlib error"));
        
    }
	catch (std::exception& _error)
	{
        if (_error.what())
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String(_error.what()));
        else
		    throw REFNEW NativeExcpetion (REFNEW PLATFORM::String("Unknown std::exception"));
	}
    finally
    {
    }
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Factory class

Cephei::QL::Instruments::IMakeOIS^ Cephei::QL::Instruments::CMakeOIS_Factory::Create (Cephei::QL::Times::IPeriod^ swapTenor, Cephei::QL::Indexes::IOvernightIndex^ overnightIndex, Microsoft::FSharp::Core::FSharpOption<Double>^ fixedRate, Microsoft::FSharp::Core::FSharpOption<Cephei::QL::Times::IPeriod^>^ fwdStart)
{
    return REFNEW CMakeOIS ( swapTenor,  overnightIndex,  fixedRate,  fwdStart);
}
